﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                    xmlns:interactivity="clr-namespace:WirelessAccessPoint.Interactivity"
                    xmlns:resources="clr-namespace:WirelessAccessPoint.Resources"
                    xmlns:model="clr-namespace:WirelessAccessPoint">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Style/CellStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate x:Key="ConfigContentTemplate" DataType="{x:Type model:WirelessAccessPointViewModel}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Label Grid.Row="0"
                   Grid.Column="0"
                   Style="{StaticResource CellLabelStyle}">
                <StackPanel Orientation="Horizontal">
                    <Label Content="&#xF101;"
                           Style="{StaticResource CellImageLabelStyle}"/>
                    <Label Content="{x:Static resources:LabelResource.SSIDWithLengthLabel}"
                           Style="{StaticResource CellTitleLabelStyle}"/>
                </StackPanel>
            </Label>
            <Label Grid.Row="0"
                   Grid.Column="1"
                   Grid.ColumnSpan="2"
                   BorderThickness="0,0,0,1"
                   Style="{StaticResource CellLabelStyle}">
                <TextBox IsEnabled="{Binding IsActiveHostedNetworkAndNetSharing, Converter={StaticResource InverseConverter}}"
                         Text="{Binding SelectedHostedNetwork.SSID, ValidatesOnDataErrors=True}">
                    <i:Interaction.Behaviors>
                        <interactivity:InputTextValidationTextBoxBehavior />
                    </i:Interaction.Behaviors>
                </TextBox>
            </Label>

            <Label Grid.Row="1"
                   Grid.Column="0"
                   Style="{StaticResource CellLabelStyle}">
                <StackPanel Orientation="Horizontal">
                    <Label Content="&#xF101;"
                           Style="{StaticResource CellImageLabelStyle}"/>
                    <Label Content="{x:Static resources:LabelResource.PassPhraseWithLengthLabel}"
                           Style="{StaticResource CellTitleLabelStyle}"/>
                </StackPanel>
            </Label>
            <Label Grid.Row="1"
                   Grid.Column="1"
                   BorderThickness="0,0,0,1"
                   Style="{StaticResource CellLabelStyle}">
                <PasswordBox IsEnabled="{Binding IsActiveHostedNetworkAndNetSharing, Converter={StaticResource InverseConverter}}"
                             IsTabStop="{Binding Path=IsChecked, ElementName=DisplayCheckBox, Converter={StaticResource InverseConverter}}">
                    <i:Interaction.Behaviors>
                        <interactivity:InputTextValidationPasswordBoxBehavior />
                        <interactivity:BindablePasswordBoxBehavior Password="{Binding SelectedHostedNetwork.PassPhrase, ValidatesOnDataErrors=True}" />
                    </i:Interaction.Behaviors>
                </PasswordBox>
            </Label>
            <Label Grid.Row="1"
                   Grid.Column="1"
                   BorderThickness="0,0,0,1"
                   Style="{StaticResource CellLabelStyle}"
                   Visibility="{Binding Path=IsChecked, ElementName=DisplayCheckBox, Converter={StaticResource BooleanToVisibilityConverter}}">
                <TextBox IsEnabled="{Binding IsActiveHostedNetworkAndNetSharing, Converter={StaticResource InverseConverter}}"
                         Text="{Binding SelectedHostedNetwork.PassPhrase, ValidatesOnDataErrors=True}">
                    <i:Interaction.Behaviors>
                        <interactivity:InputTextValidationTextBoxBehavior />
                    </i:Interaction.Behaviors>
                </TextBox>
            </Label>
            <Label Grid.Row="1"
                   Grid.Column="2"
                   BorderThickness="0,0,0,1"
                   Padding="0,7,10,7"
                   Style="{StaticResource CellLabelStyle}">
                <CheckBox x:Name="DisplayCheckBox"
                          Content="{x:Static resources:LabelResource.DisplayLabel}" />
            </Label>

            <Label Grid.Row="2"
                   Grid.Column="0"
                   BorderThickness="0,0,1,0"
                   Style="{StaticResource CellLabelStyle}">
                <StackPanel Orientation="Horizontal">
                    <Label Content="&#xF101;"
                           Style="{StaticResource CellImageLabelStyle}"/>
                    <Label Content="{x:Static resources:LabelResource.SelectedPublicNetSharingLabel}"
                           Style="{StaticResource CellTitleLabelStyle}"/>
                </StackPanel>
            </Label>
            <Label Grid.Row="2"
                   Grid.Column="1"
                   Grid.ColumnSpan="2"
                   BorderThickness="0,0,0,0"
                   Style="{StaticResource CellLabelStyle}">
                <ComboBox DisplayMemberPath="Name"
                          ItemsSource="{Binding NetSharings}"
                          IsEnabled="{Binding IsActiveHostedNetworkAndNetSharing, Converter={StaticResource InverseConverter}}"
                          SelectedValue="{Binding SelectedPublicNetSharing, ValidatesOnDataErrors=True}">
                </ComboBox>
            </Label>
        </Grid>
    </DataTemplate>

</ResourceDictionary>
